#include "widget.h"
#include "ui_widget.h"

#include <QDebug>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::on_pushButton_up_clicked()
{
    QRect rect = ui->goods->geometry();
    rect.setY(rect.y() - 5);
    rect.setHeight(rect.height() - 5);
    ui->goods->setGeometry(rect);
}


void Widget::on_pushButton_down_clicked()
{
    QRect rect = ui->goods->geometry();
    rect.setY(rect.y() + 5);
    rect.setHeight(rect.height() + 5);
    ui->goods->setGeometry(rect);
}


void Widget::on_pushButton_left_clicked()
{
    QRect rect = ui->goods->geometry();
    rect.setX(rect.x() - 5);
    rect.setWidth(rect.width() - 5);
    ui->goods->setGeometry(rect);
}


void Widget::on_pushButton_right_clicked()
{
    QRect rect = ui->goods->geometry();
    rect.setX(rect.x() + 5);
    rect.setWidth(rect.width() + 5);
    ui->goods->setGeometry(rect);
}


void Widget::on_pushButton_add_clicked()
{
    float opacity = this->windowOpacity();
    if(opacity >= 1) return;
    opacity += 0.1;
    qDebug() << opacity;
    this->setWindowOpacity(opacity);
}


void Widget::on_pushButton_sub_clicked()
{
    float opacity = this->windowOpacity();
    if(opacity <= 0.1) return;
    opacity -= 0.1;
    qDebug() << opacity;
    this->setWindowOpacity(opacity);
}

